package headfirst.designpatterns.factory.a_pizzas_simpleFactory.factory;

import headfirst.designpatterns.factory.a_pizzas_simpleFactory.pizza.*;

public class SimplePizzaFactory {

	public Pizza createPizza(String type) {
		Pizza pizza = null;

		if (type.equals("cheese")) {
			pizza = new CheesePizza();
			System.out.println("创建了 CheesePizza");
		} else if (type.equals("pepperoni")) {
			pizza = new PepperoniPizza();
			System.out.println("创建了 PepperoniPizza");
		} else if (type.equals("clam")) {
			pizza = new ClamPizza();
			System.out.println("创建了 ClamPizza");
		} else if (type.equals("veggie")) {
			pizza = new VeggiePizza();
			System.out.println("创建了 VeggiePizza");
		}
		return pizza;
	}
}
